<div class="span9">
    <div class="row">
        <!-- widget area, which ones? -->
        <div class="span3">
            <div class="row">
                <?php 
                foreach($widgets as $w) {
                    print $w;
                }
                ?>
            </div>
            <h4 class="title">Aktuellt</h4>
            <div class="box nopad">
                <div class="accordion aktuellt_box" id="accordion2">
                    <?php 
                        // News titles loop
                    $counter = 0;
                    foreach($news as $n) : 
                        ?>
                    <div class="accordion-group">
                        <div class="accordion-heading">
                            <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse<?php echo $counter;?>">
                                <strong><?php echo $n->headline;?></strong><br/>
                                <?php echo $n->datum;?>
                            </a>
                        </div>
                        <div id="collapse<?php echo $counter;?>" class="accordion-body collapse <?php echo $counter === 0? 'in':'out';?>">
                            <div class="accordion-inner">
                                <?php echo getContentx($n, false);?>
                            </div>
                        </div>
                    </div>
                    <?php 
                    $counter ++;
                    endforeach; 
                    ?>
                </div>
            </div>
        </div>
        <div class="span6">
            <div class="row">
                <?php echo $product_html; ?>
                <a class="span3 floatingButton right" href="/sortiment">TILL SORTIMENTET &raquo;</a></div>
            </div>
        </div>
    </div>
</div>


<?php 
function getContentx($article, $fulltext){
    $rmo = "[readmore]";
    $link = "<a href='/nyheter/$article->id'>&raquo; Läs mer</a>";
    
    if($fulltext) {
        return str_replace($rmo, '', $article->content);
    } else {
        $text = $article->content;
        if(strpos($text, $rmo) > 0){
            $text = substr($text, 0, strpos($text, $rmo) + strlen($rmo));
        }
        return str_replace($rmo, $link, $text);
    }
}
?>